<?php
if( ! defined('BASEPATH')) exit('No direct script access allowed');

class Hobby extends CI_Controller
{


	function __construct()
	{
		parent::__construct();
		// check if user logged in
		if(!$this->ion_auth->logged_in()){
			redirect('auth/login');
		}
		$this->load->library('form_validation');
		$this->load->model('founder/jobprofile_model');
	}
	
	
function addskills()
	{
		$data['query'] = $this->jobprofile_model->designation_getall();
		$meta['page_title'] = "Add a skill";
		$this->form_validation->set_rules('skillname', 'Name', 'required|is_unique[skills.name]');
		$this->form_validation->set_rules('designation_id', 'Designation', 'required');
		//$this->load->model('founder/jobprofile_model');
		$config['upload_path'] = './assets/images/skills/';
		$config['allowed_types'] = 'gif|jpg|png';
		$config['max_size']	= '1000';
		$config['max_width']  = '1024';
		$config['max_height']  = '768';
//exit;
		
		$this->load->library('upload', $config);

		if ( ! $this->upload->do_upload())
		{
			$error = array('error' => $this->upload->display_errors());
		}
		else
		{
			$data['upload_data'] = ($this->upload->data());
			
	$this->jobprofile_model->skills_insert($this->input->post('designation_id'),$this->input->post('skillname'),$data['upload_data' ]['file_name']);
		}
		$data['query'] = $this->jobprofile_model->designation_getall();
		$data['getskills'] = $this->jobprofile_model->skills_getall();
		$this->load->view('common/header',$meta);
		$this->load->view('founder/add-skills',$data);
		$this->load->view('common/footer');

	}

	}